<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of sealplayer
 *
 * @author Samuel
 */
class modifysystime_controller extends Controller {
    private $areaList;	//区号列表
    function _init()
    {
        check_level(50, segment(0), segment(1), segment(2, 'index'));
        $server_list=get_server_list();
        //var_dump($server_list);
        foreach($server_list as $k=>$row) {
            $this->areaList[$row['SvrOutAddr']] = $row['SvrID']."-".$row['SvrName'][1];
        }
    }

    function index()
    {
        if(is_submit())
        {
            $rowdata = $_POST['row'];
            //var_dump($rowdata);

            $post_data['SessionID']="ewewqw";
            $post_data['SessionKey']="wqqew";

            //date_default_timezone_set("PRC");
            //$dt = new DateTime($rowdata['systime']);
            //$post_data['Time'] = $dt->getTimestamp(); //时间戳

            $post_data['Time'] = (string)$rowdata['systime'];

            $strResult = vpost($rowdata['area_host'].'/gm_modify_sys_time',3,json_encode($post_data));
            //echo $strResult;
            $result=json_decode($strResult,true);
            //操作失败或者连接失败
            if($result['RetCode'] == 0)
            {
                insert_log(translate('MENU_SEND_OBJECT'),translate('ADD'),NULL,$rowdata);
                echo "<script>alert('".translate('C_TIPS_SUCCESS_TEXT')."')</script>";
            }
            else
            {
                unset($rowdata);
                echo "<script>alert('".translate('C_TIPS_ERROR_TEXT')."')</script>";
            }
        }
        //var_dump($this->areaList);
        $this->view->assign("arealist", $this->form->select("row[area_host]", $this->areaList, '', array('id' => 'area_host')));

        date_default_timezone_set("PRC");
        $this->view->assign('systime', date('Y-m-d H:i:s', time()));
        $this->view->display("seal/modifysystime/modify");
    }

}

?>
